#include "MoveScoreList.h"
#include <cassert>


MoveScoreList::MoveScoreList(void)
{
	_size = 0;
}

MoveScoreList::~MoveScoreList(void)
{
	//nothing to delete
}

inline int MoveScoreList::GetSize(){
	return _size;
}

inline Move MoveScoreList::GetMove(int i){
	assert(i>0 && i<_size);
	return _move[i];
}

inline int MoveScoreList::GetScore(int i){
	assert(i>0 && i<_size);
	return _score[i];
}

inline void MoveScoreList::Clear(){
	_size = 0;
}

void MoveScoreList::Add(Move move , int score){
	assert(_size<LISTMAXSIZE);
	_move[_size] = move;
	_score[_size] = score;
	_size++;
}

// Remove item at index i
// (overwrite index i with las item of the list)
// WARNING: the order is changed
void MoveScoreList::Remove(int i){
	assert(i>0 && i<_size);
	_move[i] = _move[_size-1];
	_score[i] = _score[_size-1];
	_size--;
}
